# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# Packaged as a tw.jquery widget by Ciaran Farrell <cfarrell1980@gmail.com>

from tw.api import Widget, JSLink, CSSLink, js_function, js_callback
from tw.forms.fields import TableForm
from tw.jquery.base import *

jQuery = js_function('$')

jquery_tools_js = JSLink(
        filename='static/javascript/jquery.tools.min.js',
        javascript=[jquery_js],
        modname=__name__)

jquery_tabs_css = CSSLink(
        filename='static/css/tabs.css',
        modname=__name__)

class Tabs(Widget):
    javascript=[jquery_tools_js]
    css=[jquery_tabs_css]
    #template="genshi:"
    def update_params(self,d):
        super(Tabs,self).update_params(d)
        #self.update_attrs(d, "size")
        #d['attrs']['multiple'] = True
        #self.add_call("$(function(){$('ul.tabs').tabs('div.panes > div')")
        self.add_call("$(function(){$('ul.tabs').tabs('div.panes > div');});")

